home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
FM Towns: Free Software Collection 6
/
FM Towns Free Software Collection 6.iso
/
t_os
/
townsmsx
/
scc2tif.bas
< prev
next >
Wrap
BASIC Source File
|
1993-07-08
|
5KB
|
152 lines
1000 ' MSX SCREEN12 -> 無圧縮TIFF 変換
1010 ' BY ちにゃと
1015 CLEAR ,,,300000
1016 STOP OFF
1017 DEFLNG I,J
1020 DEFINT M,T,S,R,G,B,Y,K
1030 DIM MSX(32768)
1050 DIM SCC(27135)
1060 DIM TIF(54527)
2000 *メイン
2002 ON ERROR GOTO 0
2010 GOSUB *FILE_SLCT
2020 GOSUB *FILE_LOAD
2030 GOSUB *CONVERT
2040 GOSUB *SAVE
2045 'GOSUB *LOOK
2050 PRINT "続けますか? (Y/N)"
2060 A$=INKEY$
2070 IF A$="y" OR A$="Y" THEN *メイン
2080 IF A$="N" OR A$="n" THEN END
2090 GOTO 2060
3000 *FILE_SLCT
3010 INPUT "ドライブは? (A,B,D)";A$
3020 IF A$<>"A" AND A$<>"B" AND A$<>"D" AND A$<>"a" AND A$<>"b" AND A$<>"d" THEN 3010
3030 IF A$="a" OR A$="A" THEN DRV$="A:"
3040 IF A$="B" OR A$="b" THEN DRV$="B:"
3050 IF A$="D" OR A$="d" THEN DRV$="D:"
3055 ON ERROR GOTO 10000
3060 PRINT "<*.SCC>":FILES DRV$+"*.SCC"
3070 PRINT "<*.SRS>":FILES DRV$+"*.SRS"
3075 ON ERROR GOTO 0
3080 INPUT "ファイル名を入力してください";FIL$
3090 IF FIL$="" THEN RETURN *メイン
3100 RETURN
4000 *FILE_LOAD
4010 ON ERROR GOTO *エラートラップ2
4020 LOAD@ DRV$+FIL$,MSX
4030 ON ERROR GOTO 0
4040 RETURN
5000 *CONVERT
5010 FOR J=0 TO 256*212/2-2
5020 POKE VARPTR(SCC(J)),PEEK(VARPTR(MSX(0))+(J+3)*2+1)
5025 POKE VARPTR(SCC(J))+1,PEEK(VARPTR(MSX(0))+(J+4)*2)
5030 NEXT J
5035 PRINT "pass1 ok"
5036 FOR I=0 TO 3:Y(I)=0:R(I)=0:G(I)=0:B(I)=0:NEXT I:K=0:KJ=0:J=0
5038 AD&=VARPTR(SCC(0))
5040 FOR J=0 TO 256*212/2-2 STEP 2
5060 Y(0)=PEEK(AD&+J*2) \ 8
5070 Y(1)=PEEK(AD&+J*2+1) \ 8
5080 Y(2)=PEEK(AD&+(J+1)*2) \ 8
5090 Y(3)=PEEK(AD&+(J+1)*2+1) \ 8
5100 K=(PEEK(AD&+J*2) AND 7)+(PEEK(AD&+J*2+1) AND 3)*8
5110 KJ=(PEEK(AD&+(J+1)*2) AND 7)+(PEEK(AD&+(J+1)*2+1) AND 3)*8
5112 IF (PEEK(AD&+J*2+1) AND 4)<>0 THEN K=-32+K
5114 IF (PEEK(AD&+(J+1)*2+1) AND 4)<>0 THEN KJ=-32+KJ
5120 FOR I=0 TO 3
5130 R(I)=Y(I)+KJ
5140 G(I)=Y(I)+K
5150 B(I)=INT(Y(I)*5/4-KJ/2-K/4)
5160 IF R(I)<0 THEN R(I)=0
5170 IF G(I)<0 THEN G(I)=0
5180 IF B(I)<0 THEN B(I)=0
5190 IF R(I)>31 THEN R(I)=31
5200 IF G(I)>31 THEN G(I)=31
5210 IF B(I)>31 THEN B(I)=31
5220 TIF(256+J*2+I)=G(I)*1024+R(I)*32+B(I)
5230 NEXT I
5240 NEXT J
5245 PRINT "pass2 ok"
5250 RESTORE *DATA
5260 FOR I=0 TO 95
5270 READ A$,B$
5280 POKE VARPTR(TIF(0))+I*2,VAL("&H"+A$)
5290 POKE VARPTR(TIF(0))+I*2+1,VAL("&H"+B$)
5300 NEXT I
5310 FOR I=248 TO 255
5320 READ A$,B$
5330 POKE VARPTR(TIF(0))+I*2,VAL("&H"+A$)
5340 POKE VARPTR(TIF(0))+I*2+1,VAL("&H"+B$)
5350 NEXT I
5360 RETURN
6000 *SAVE
6010 PRINT "コンバート終了しました。"
6020 PRINT:INPUT "セーブするドライブを指定して下さい。 (A/B/D)";A$
6030 IF A$="" THEN RETURN
6040 IF A$="A" OR A$="a" THEN DRV$="A:"
6050 IF A$="B" OR A$="b" THEN DRV$="B:"
6070 IF A$="D" OR A$="d" THEN DRV$="D:"
6075 'FIL$="gallery6.scc":DRV$="d:"
6080 FIL=INSTR(FIL$,".")
6090 FIL$=LEFT$(FIL$,FIL-1)
6095 'PRINT "#####";DRV$+FIL$+".tif";"####":END
6100 ON ERROR GOTO *ERROR3
6110 FILES DRV$+FIL$+".TIF"
6112 INPUT "同名のTIFファイルがあります。上書きしますか? (Y/N)";A$
6114 IF A$="Y" OR A$="y" THEN GOTO *DEL
6116 IF A$="n" OR A$="N" THEN RETURN *メイン
6118 GOTO 6112
6120 *SAVEMAIN
6122 ON ERROR GOTO *ERROR4
6130 SAVE@ DRV$+FIL$+".$$$",TIF
6140 ON ERROR GOTO 0
6150 NAME DRV$+FIL$+".$$$" AS FIL$+".TIF"
6160 RETURN
6170 *ERROR3
6175 RESUME *SAVEMAIN
6212 *DEL
6213 ON ERROR GOTO 0:'*ERROR4
6214 KILL DRV$+FIL$+".TIF"
6215 ON ERROR GOTO 0
6216 GOTO *SAVEMAIN
6220 *ERROR4
6230 PRINT "書き込めません。"
6240 RESUME *メイン
7000 *LOOK
7010 SCREEN@ 1,0
7020 LOAD@ DRV$+FIL$+".tif",(32,14)
7025 'LOAD@ "q:\fj\photo\cat2.tif",(32,14)
7030 IF INKEY$="" THEN 7030
7040 SCREEN@ 0:CLS 0
7050 RETURN
10000 *エラートラップ
10010 PRINT "ファイルがありません"
10020 RESUME NEXT
10100 *エラートラップ2
10110 PRINT "ファイル名が間違っています。"
10120 RESUME *メイン
20000 A%=16:PRINT A%:PRINT "&h";" 0";HEX$(PEEK(VARPTR(A%)));" 0";HEX$(PEEK(VARPTR(A%)+1))
30000 *DATA
30002 ' TIFF HEADER
30005 ' +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F
30010 DATA 49,49,2A,00,08,00,00,00,0F,00
30020 DATA FE,00,04,00,01,00,00,00,00,00,00,00
30040 DATA 00,01,03,00,01,00,00,00,00,01,00,00
30050 DATA 01,01,03,00,01,00,00,00,D4,00,00,00
30060 DATA 02,01,03,00,01,00,00,00,10,00,00,00
30070 DATA 03,01,03,00,01,00,00,00,01,00,00,00
30080 DATA 06,01,03,00,01,00,00,00,01,00,00,00
30090 DATA 0A,01,03,00,01,00,00,00,01,00,00,00
30100 DATA 11,01,04,00,01,00,00,00,00,02,00,00
30110 DATA 15,01,03,00,01,00,00,00,01,00,00,00
30120 DATA 16,01,04,00,01,00,00,00,D4,00,00,00
30130 DATA 17,01,04,00,01,00,00,00,00,AA,01,00
30140 DATA 19,01,03,00,01,00,00,00,FF,7F,00,00
30150 DATA 1A,01,05,00,01,00,00,00,F0,01,00,00
30160 DATA 1B,01,05,00,01,00,00,00,F8,01,00,00
30170 DATA 1C,01,03,00,01,00,00,00,01,00,00,00
30180 DATA 00,00
30190 DATA 4B,00,00,00,02,00,00,00
30200 DATA 4B,00,00,00,02,00,00,00